package com.old.people.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.old.people.entities.Account;
import com.old.people.entities.DieasePeople;
import com.old.people.service.ManagerService;

@RestController
public class ManagerController {
	@Autowired
	private ManagerService managerService;

	@RequestMapping("/oldpeopleservice/getAllAccount")
	@ResponseBody
	public List<Account> accountManager(@RequestParam("page") int page) {// 获取下一页的数据
		return managerService.accountManager(page);
	}

	@RequestMapping("/oldpeopleservice/getAllAccountPageSum")
	@ResponseBody
	public int accountSumManager() {// 获取总页数
		return managerService.accountSum();
	}

	@RequestMapping("/oldpeopleservice/updateAccountType")
	@ResponseBody
	public boolean updateAccountType(String account_id, String account_type) {// 更新账号 注册或者注销
		return managerService.updateAccountType(account_id, account_type);
	}

	@RequestMapping("/oldpeopleservice/selectAccount")
	@ResponseBody
	public Account selectAccount(String account_id) {// 查询账号
		return managerService.selectAccount(account_id);
	};

	@RequestMapping("/oldpeopleservice/getDieasePeople")
	@ResponseBody
	public List<DieasePeople> getDieasePeople(Integer page){
		return managerService.getDieasePeople(page);
	}

	@RequestMapping("/oldpeopleservice/getDieasePeopleSum")
	@ResponseBody
	public Integer getDieasePeopleSum() {
		return managerService.getDieasePeopleSum();
	}

	@RequestMapping("/oldpeopleservice/selectDieasepeople")
	@ResponseBody
	public List<DieasePeople> selectDieasepeople(String oldpeople_name) {
		return managerService.selectDieasepeople(oldpeople_name);
	}

	@RequestMapping("/oldpeopleservice/updateAccount")
	@ResponseBody
	public boolean updateAccount(String account_id, String account_password) {
		return managerService.updateAccount(account_id, account_password);
	}
}
